package com.atguigu.config;

import com.atguigu.interceptor.DemoInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @auther zzyy
 * @create 2025-01-03 13:41
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Resource
    private DemoInterceptor demoInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(demoInterceptor).addPathPatterns("/**"); // 拦截所有接口
    }
}
